<include file="Public:header_user"/>

<div class="title_member">
	<h2>订单详情</h2>
</div>
<form class="ajax-form" action="" method="post">
<div class="order_detail border_grey" style="margin-top: 25px;">
	<table class="lawyer_table lawyer_table_order">
		<thead>
			<tr>
				<th>订单编号</th>
				<th>类别</th>
				<th>服务名称</th>
				<th>状态</th>
				<th>买家</th>
				<th>订单金额</th>
				<th>下单时间</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>{$info['order_sn']}</td>
				<td>{$info['category_name']}</td>
				<td>{$info['title']}</td>
				<td>
					<span style="color: {$info['status_color']}">{$info['lawyer_status_desc']}</span>
				</td>
				<td class="buyer">
					<span>{$info['user_name']}</span>
					<span>{$info['user_mobile']}</span>
				</td>
				<td class="money"><strong>{$info['order_amount']}</strong></td>
				<td>{$info['datetime']}</td>
			</tr>
		</tbody>
	</table>
	<div class="title">
		<h3>买家需求描述</h3>
	</div>
	<div class="contract_info">
		<p>{$info['demand']|default='无'}</p>
	</div>
	<div class="title">
		<h3>客服确认需求</h3>
	</div>
	<div class="description">
		<p>{$info['service_confirm_demand']}</p>
		<ul class="file-download">
			<volist name="info.agreement_file_list" id="rs">
			<li>附件：{$rs['filename']}<a class="btn" href="{$rs['file_url']}" target="_blank">下载</a></li>
			</volist>
		</ul>
	</div>
	<div class="title">
		<h3>工作记录</h3>
	</div>
	<table class="lawyer_table_record">
		<thead>
			<tr>
				<th>记录</th>
				<th class="time">时间</th>
				<eq name="info.status" value="doing-lawyer">
				<th class="operate">操作</th>
				</eq>
			</tr>
		</thead>
		<tbody class="todo-list">
			<volist name="info.todo_list" id="rs">
			<tr class="todo-{$rs['id']}">
				<td class="content">{$rs['content']}</td>
				<td>{$rs['datetime']}</td>
				<eq name="info.status" value="doing-lawyer">
				<td class="operate">
					<a class="del-todo btn-confim-opt" del-class="todo-{$rs['id']}" url="{:U('del_todo', array('id' => $rs['id']))}" msg="您确定要删除此记录操吗？">删除</a>
				</td>
				</eq>
			</tr>
			</volist>
		</tbody>
	</table>
	<eq name="info.status" value="doing-lawyer">
	<div class="todo-box">
		<input type="text" name="record_content" class="todo-input" placeholder="输入工作内容，回车添加记录">
	</div>
	</eq>
	<div class="title">
		<h3>完成结果</h3>
	</div>
	<div class="contract_info">
		{:W('Plugin/upload_file', array('finish_file_ids', 'file', '合同', '', 0, '', 0, '', $info['status'] == 'doing-lawyer' ? 1 : 0))}
	</div>
	<notempty name="info.audit_comment">
	<div class="title">
		<h3>审核结果</h3>
	</div>
	<div class="description">
		<span style="color: {$info['audit_status_color']}">
			{$info['order_audit_status_desc']} ： {$info['audit_comment']}
		</span>
	</div>
	</notempty>
</div>
<eq name="info.status" value="doing-lawyer">
<div class="clearfix operate_order_save">
	<input class="btn" type="submit" value="确认完成">
</div>
</eq>
</form>
<script type="text/javascript">
$(document).ready(function(){
	$(".todo-input").keydown(function(event){
		switch(event.keyCode) {
			// 回车处理
			case 13:
				var here = $(this);
				var val  = here.val();
				var url  = '{:U("add_todo", array("order_sn" => $info["order_sn"]))}';
				var data = 'content=' + encodeURIComponent(val);

				loading();
				$.ajax({
					url : url,
					data : data,
					type : 'post',
					dataType:'json',
					success : function(json){
						removeLoading();
						if(json.status == 1){
							var content  = json.data.content;
							var datetime = json.data.datetime;
							var html = '<tr> <td class="content">' + content + '</td> <td>' + datetime +'</td> <td class="operate"><a class="">删除</a></td></tr>';

							$('.todo-list').append(html);
							here.val('');
						}else{
							msgbox(json.info, 'error');
						}
					},
					error : function () {
						removeLoading();
						msgbox('请求失败，请稍候再试！', 'error');
					}
				});
				break;
		}
	});
});
</script>
<include file="Public:footer_user"/>